#ifndef HK_VEHICLECOLLISIONEVENTS_H
#define HK_VEHICLECOLLISIONEVENTS_H


#include <Physics/Dynamics/Collide/hkpCollisionListener.h>
#include <Physics/Dynamics/Entity/hkpEntityListener.h>

class racing_logic_shell ;


class VehicleCollisionEvents : public hkReferencedObject, public hkpCollisionListener, public hkpEntityListener
{

public:

    HK_DECLARE_CLASS_ALLOCATOR( HK_MEMORY_CLASS_DEMO );

    /*
     * Construction and Destruction
     */

    VehicleCollisionEvents(hkpRigidBody* , int car_id, racing_logic_shell* shell);
    virtual ~VehicleCollisionEvents();


    /*
     * Members from base class hkpCollisionListener which must be implemented:
     */

    // Called after a contact point was added 
    virtual void contactPointAddedCallback(	hkpContactPointAddedEvent& event );

    virtual void contactPointConfirmedCallback( hkpContactPointConfirmedEvent& event);

    // Called before a contact point gets removed. We do not implement this for this demo.
    virtual void contactPointRemovedCallback( hkpContactPointRemovedEvent& event );

    // Called just before the collisionResult is passed to the constraint system (solved).
    virtual void contactProcessCallback( hkpContactProcessEvent& event );

    /*
     * Members from base class hkpEntityListener which must be implemented:
     */


    // Called when the entity is deleted. Important to use this event to remove ourselves as a listener.
    void entityDeletedCallback( hkpEntity* entity );

    // Called when the entity is removed from the hkpWorld
    void entityRemovedCallback( hkpEntity* entity );

protected:
    // a small structure, which gets attached to each contact point
    struct  ContactPointInfo
    {
        HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_DEMO,  ContactPointInfo);
        int m_uniqueId;
    };
    int m_uniqueIdCounter;

public:
    inline bool is_need_to_clear_drift() {return m_isNeedToClearDrift;}
    inline void do_clear_drift() {m_isNeedToClearDrift = false;}

public:

    int m_reportLevel;

private:
    hkpRigidBody* m_fatherRigidBody;
    bool m_isNeedToClearDrift;
    int m_car_id ;
    racing_logic_shell* m_shell ;
    

};





#endif
